from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status

class LexicalAnalysisTests(TestCase):
    def setUp(self):
        self.client = APIClient()

    def test_chinese_analysis(self):
        data = {
            'text': '这是一个测试句子',
            'language': 'zh'
        }
        response = self.client.post('/api/analyze/', data, format='json')
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertIn('tokens', response.data)
        self.assertIn('pos_tags', response.data)

    def test_english_analysis(self):
        data = {
            'text': 'This is a test sentence',
            'language': 'en'
        }
        response = self.client.post('/api/analyze/', data, format='json')
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertIn('tokens', response.data)
        self.assertIn('pos_tags', response.data)
